package com.bioroadlab.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 * DiseaseType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "disease_type", catalog = "bioroadlab")
public class DiseaseType implements java.io.Serializable {

	// Fields

	private static final long serialVersionUID = 1L;

	private Integer sn;
	private DiseaseCategory diseaseCategory;
	private String name;
	private Set<Disease> diseases = new HashSet<Disease>(0);

	// Property accessors
	@TableGenerator(table = "id_generator", name = "generator", pkColumnName = "name", pkColumnValue = "DiseaseType", valueColumnName = "id", initialValue = 1, allocationSize = 1)
	@Id
	@GeneratedValue(generator = "generator", strategy = GenerationType.TABLE)
	@Column(name = "sn", unique = true, nullable = false)
	public Integer getSn() {
		return this.sn;
	}

	public void setSn(Integer sn) {
		this.sn = sn;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "category", nullable = false)
	public DiseaseCategory getDiseaseCategory() {
		return this.diseaseCategory;
	}

	public void setDiseaseCategory(DiseaseCategory diseaseCategory) {
		this.diseaseCategory = diseaseCategory;
	}

	@Column(name = "name", length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "diseaseType")
	public Set<Disease> getDiseases() {
		return this.diseases;
	}

	public void setDiseases(Set<Disease> diseases) {
		this.diseases = diseases;
	}

}